package com.Utils;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @User xiangyl
 * @Data 2020/9/20
 */
public class DateUtil {

    private final static SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");

    public static Date stringToDate(String s){
        Date date=null;
        try {
            date = sdf.parse(s);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }

    public static String dateToString(Date date){
        String dateString = sdf.format(date);
        return dateString;
    }

    public static String stringSplit(String src){
        String des = src.substring(0, 10);
        return des;
    }
}
